﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Warehouse.ascx.cs" Inherits="Admin_Components_Inventory_Warehouse" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True"></telerik:RadScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:radformdecorator id="QsfFromDecorator" runat="server" decoratedcontrols="All"
            enableroundedcorners="false" />
        <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
            <Tabs>
                
                <telerik:RadTab Text="XEM TỒN KHO" Selected="True"></telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
            <!--Tim kiem -->
    <telerik:RadPageView ID="RadPageView3" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                    <!--Block bên trái -->
                 <div class="form-group col-md-6">
                     
                  <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên cửa hàng</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cbShop" runat="server" CssClass="col-imp-8" TabIndex="1" Width="70px" AllowCustomText="false" />
                        </div>
                    </div>
                  <!--End Dòng -->
                    
                </div>
                 <!--End Block bên trái -->
                     <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <!--Dòng -->
                <div class="form-group">
                    <label class="col-md-3 control-label">Thuộc loại</label>
                    <div class="col-md-7">
                        <telerik:RadComboBox ID="cbType" runat="server" CssClass="col-imp-5"  filter="Contains" AutoPostBack="true" OnSelectedIndexChanged="cbType_SelectedIndexChanged" >
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả" Value="" />
                                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                                </Items>
                            </telerik:RadComboBox>
                        
                     </div>
                </div>
                <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Tên sản phẩm</label>
                        <div class="col-md-8">
                          <telerik:RadComboBox ID="cbProduct" runat="server" CssClass="col-imp-8"  ></telerik:RadComboBox>
                         </div>
                    </div>
                    <!--End Dòng -->
                   
                </div>
                 <!--End Block bên phải -->
                </div>
                <!--Button Tim Kiem-->
                 <div class="set-btns text-center">
                     <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" OnClick="btnSearch_Click" Text="Tìm kiếm"  />
                </div> 
                <!--End Button Tim Kiem--> 
                </fieldset>
        <br />
        <!--Grid data-->
            <div class="row">
                <div style="float: left;font-weight:bold" runat="server" id="div_TotalRows" >&nbsp;Kết quả tìm kiếm: 0</div>
                
            <telerik:radgrid id="gvData" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" PageSize="10" AllowCustomPaging="true"
                allowmultirowselection="True" headerstyle-borderstyle="None" Height="250" ShowHeader="true" OnNeedDataSource="gvData_NeedDataSource" >
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate><%# Container.ItemIndex + 1 %>
                            </ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Tên sản phẩm" UniqueName="ProductName" DataField="ProductName">
                            <ItemTemplate>
                                <asp:Label ID="lblProductName" runat="server" Text='<%# Eval("ProductName")%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center"  Width="300px"  />
                        <ItemStyle HorizontalAlign="Left" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>
                     <telerik:GridBoundColumn  DataField="ShopName" UniqueName="ShopName"  ReadOnly="true" HeaderText="Cửa hàng">
                        <HeaderStyle HorizontalAlign="Center"  Width="150px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                   <telerik:GridTemplateColumn HeaderText="Giá nhập(VNĐ)" UniqueName="PurchasePrice" DataField="PurchasePrice">
                            <ItemTemplate>
                                <asp:Label ID="lblPurchasePrice" runat="server" Text='<%# String.Format("{0:N0}", float.Parse(Eval("PurchasePrice").ToString() == "" ? "0" : Eval("PurchasePrice").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Số lượng tồn" UniqueName="Quantity" DataField="Quantity">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0:N0}", float.Parse(Eval("Quantity").ToString() == "" ? "0" : Eval("Quantity").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Trọng lượng(kg)" UniqueName="Weight" DataField="Weight">
                            <ItemTemplate>
                                <asp:Label ID="lblWeight" runat="server" Text='<%# String.Format("{0:N0}", float.Parse(Eval("Weight").ToString() == "" ? "0" : Eval("Weight").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Thành tiền(VNĐ)" UniqueName="TotalAmount" DataField="TotalAmount">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# String.Format("{0:N0}", float.Parse(Eval("TotalAmount").ToString() == "" ? "0" : Eval("TotalAmount").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="180px" />
                            <ItemStyle HorizontalAlign="Right" Width="180px" Font-Bold ="true"/>
                    </telerik:GridTemplateColumn>
                   
                     
                    <%--<telerik:GridTemplateColumn HeaderText="Chi tiết" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button1" CssClass="btnViewDetail" CommandArgument='<%# Eval("TransferWarehouseID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                        <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                    </telerik:GridTemplateColumn>--%>
                    <%--<telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button2" CssClass="btnX" CommandArgument='<%# Eval("TransferWarehouseID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>--%>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data--> 
    </telerik:RadPageView>
    <!--End Tab Tim kiem -->
     </telerik:RadMultiPage>
<div style="clear:both"></div>
</ContentTemplate>
</asp:UpdatePanel>

<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>

<script type="text/javascript">
    function OnClientClose(oWnd, args) {

    }
    function FormatNumber(obj) {

        var x;

        if (eval(obj))

            x = eval(obj).value;

        else

            x = obj;

        var num = x.replace(/$|,/g, '');

        if (isNaN(num)) { num = ""; }

        sign = (num == (num = Math.abs(num)));

        num = Math.floor(num * 100 + 0.50000000001);

        num = Math.floor(num / 100).toString();

        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3) ; i++) {

            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));

        }

        eval(obj).value = num;

    }
</script>
